/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package chat02;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * <p>Project: jse2204 - Server
 * <p>Powered by webrx On 2022-09-29 15:32:02
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Server {
    public static void main(String[] args) {
        try{
            ServerSocket server = new ServerSocket(6578);
            Socket c = server.accept();
            PrintWriter writer = new PrintWriter(c.getOutputStream());
            BufferedReader reader = new BufferedReader(new InputStreamReader(c.getInputStream()));
            ChatUtil cu = new ChatUtil(writer,reader,"服务器");
            new Thread(cu::a).start();
            new Thread(cu::b).start();
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}
